 <%@ Page Language="VB" MasterPageFile="~/MasterPageExpandable.master" AutoEventWireup="false" CodeFile="SpendingPlanEntry.aspx.vb" Inherits="BudgetOnlineEntry_SpendingPlanEntry" title="Spending Plan Entry" %>
 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
 <%@ Register Src="~/AJAX/PopupMessage.ascx" TagName="PopupMessage" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript" type="text/javascript">
    function toggleCatDiv(categoryId)
    {
      var divId='Cat' + categoryId;
      var hrefId='href' + categoryId;
      
      var divObj=document.getElementById(divId);
      var hrefObj=document.getElementById(hrefId);
      
      if (divObj.style.display=='none')
       {
           divObj.style.display='block';
           hrefObj.innerText='-';
       }
      else
        {
           divObj.style.display='none';
           hrefObj.innerText='+';
        }

    }
    
    //function toggleSpendingPlanOption(radioListId)
   // {
   //    if (document.getElementById(radioListId).options[0].selected)
   // }
    
    function ExcelIF(cond,val1,val2)
    {
       if (cond)
          return EvaluateValue(val1);
       else
           return EvaluateValue(val2);
    }
    
    function EvaluateValue(val)
    {
       if (isNaN(val))
           return 0;
       else
           {
            var roundTwo=Math.round(100*val)/100;            
            return parseFloat(roundTwo);
            
           }
    }
    
 
 
    
    function MoneyValue(val)
    {
         var currValue=EvaluateValue(val);
           var roundTwo=Math.round(100*currValue)/100;
            var roundOne=Math.round(10*currValue)/10;
            var roundZero=Math.round(currValue);
            
            //alert(val);
            
            if (roundZero==roundTwo)
                    return roundTwo + '.00';
            
            if (roundOne==roundTwo)
                     return roundTwo + '0';
                     
            return roundTwo;
    }
    
    
    
    function ROUND(val, digits)
    {
          var currValue=EvaluateValue(val);
           var roundTwo=Math.round(100*currValue)/100;
            var roundOne=Math.round(10*currValue)/10;
            var roundZero=Math.round(currValue);
            
            if (digits==0)
                  return roundZero;
                  
            if (digits==1)
                  return roundOne;
            else
                  return roundTwo;      
    }
    
   function ValidateInteger(source, clientside_arguments)
   {  
      
       if (isNaN(parseInt(clientside_arguments.Value)))
             clientside_arguments.IsValid=false;
       else
       {
          clientside_arguments.IsValid = parseFloat(parseInt(clientside_arguments.Value))==parseFloat(clientside_arguments.Value);
       }
   }
   
        function ValidateDecimal(source, clientside_arguments)
     { 
     
       if (isNaN(parseFloat(clientside_arguments.Value)))
             clientside_arguments.IsValid=false;
       else
          {
             clientside_arguments.IsValid=true;
              clientside_arguments.Value=parseFloat(clientside_arguments.Value);
          }
     }
   
   
    function CancelChanges()
    {
        if (confirm('Are you sure you want to cancel your changes?  Any changes since your last save will be discarded.'))
            self.close();
        else
            return false;
    }
    
</script>

<asp:Literal ID="javascriptLiteral" runat="server"></asp:Literal>
<div id="pageDiv" runat="server" style="height:850px; overflow:auto;">
<cc1:Accordion ID="SpendingPlanAccordion" runat="server" SelectedIndex="0"
            HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected"
            ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="40" 
            TransitionDuration="250" AutoSize="None" RequireOpenedPane="true" SuppressHeaderPostbacks="true">
  <Panes>
    <cc1:AccordionPane ID="SelectPane" runat="server">
    <Header>Spending Plan Selection</Header>
    <Content><table border="0" style="width:750px;">
                        <tr>
                          <td style="text-align:right; width:300px;"><asp:Label ID="SpendingPlanLabel" runat="server" Text="Select Spending Plan:" Font-Names="Arial,MS Sans Serif,Verdana,Sans-Serif" Font-Size="smaller"></asp:Label></td><td><asp:DropDownList ID="SpendingPlanDropDownList" runat="server"></asp:DropDownList></td></tr>
                        <tr><td></td><td style="text-align:left;">
                        <asp:RadioButtonList ID="SpendingPlanOption" runat="server" CssClass="labelSmallNoWidthOrAlign" RepeatColumns="1" AutoPostBack="true">
                         <asp:ListItem Text="Edit this Plan (Valid for Drafted Status only)" Value="0" Selected="True"></asp:ListItem>
                         <asp:ListItem Text="Make Copy of Plan, and select Budget and/or Date Range" Value="1"></asp:ListItem>
                         <asp:ListItem Text="Create Blank Spending Plan" Value="2"></asp:ListItem>
                        </asp:RadioButtonList></td></tr>
                        <tr id="selectionRowHeader" runat="server"><td colspan="2" style="text-align:center;" ><asp:Label CssClass="labelSmallNoWidthOrAlign" runat="server" ID="InstructLabel" Text="If copying to new plan, or creating a brand new one, select items below."></asp:Label></td></tr>
                       <tr id="selectionRow1" runat="server"><td style="text-align:right;"><asp:Label ID="BudgetLabel" runat="server" Font-Names="Arial,MS Sans Serif,Verdana,Sans-Serif" Text="Budget:" Font-Size="Smaller"></asp:Label></td><td><asp:DropDownList ID="BudgetDropDownList" runat="server"></asp:DropDownList></td></tr>
                       <tr id="selectionRow2" runat="server"><td style="text-align:right;"><asp:Label ID="DateRangeLabel" runat="server" Font-Names="Arial,MS Sans Serif,Verdana,Sans-Serif" Text="Spending Plan Date Range:"></asp:Label></td>
                            <td><asp:TextBox ID="StartDateTextBox" runat="server"></asp:TextBox>&nbsp;to&nbsp;<asp:TextBox ID="EndDateTextBox" runat="server"></asp:TextBox></td></tr>
                       <tr id="selectionRow3" runat="server"><td colspan="2" align="center"><asp:Button ID="GetSpendingPlanButton" runat="server" Text="Get Spending Plan" /></td></tr>
                        </table>
                        <cc1:CalendarExtender ID="StartDateExtender" TargetControlID="StartDateTextBox" runat="server"></cc1:CalendarExtender>
                        <cc1:CalendarExtender ID="EndDateExtender" TargetControlID="EndDateTextBox" runat="server"></cc1:CalendarExtender>
                         
                        </Content>
    </cc1:AccordionPane>
    <cc1:AccordionPane ID="ResultsPane" runat="server">
    <Header><asp:Label ID="SpendingPlanDetailsLabel" runat="server" Text="Spending Plan Details"></asp:Label></Header>
    <Content>
    <div id="resultsDiv" runat="server" style="overflow:auto; height:400px;">
            <asp:DataList ID="CategoryDataList" runat="server" >
   <ItemTemplate>
               <table style="width:850px;" ><tr><td style="font-family:Arial,MS Sans Serif,Verdana,Sans-Serif;font-size: x-large;font-weight:bold; width:10px;">
                <a id='href<%#Eval("BudgetCategoryId") %>' href=javascript:toggleCatDiv('<%#Eval("BudgetCategoryId") %>')>+</a>
                </td><td style="width:420px;">
               <asp:Label ID="CategoryNameLabel" runat="server" Text='<%#Eval("DisplayName") %>' Font-Bold="true" Font-Names="Arial,MS Sans Serif,Verdana,Sans-Serif" Font-Size="Small" CssClass="fontBold"></asp:Label></td>
               <td align="right" style="width:420px;">Total:  $<asp:TextBox ID="CategoryTotalTextBox" runat="server" Enabled="true"  BorderStyle="None" Columns="5" BackColor="Transparent" ForeColor="black" Font-Names="Arial,MS Sans Serif,Verdana,Sans-Serif" Font-Size="Smaller"></asp:TextBox></td>
               </tr>
                      <tr><td style="width:10px;"></td>
                      <td colspan="2">  <div id='Cat<%#Eval("BudgetCategoryId") %>' style="display:none; background-color: Transparent; border:1px solid; font-family:Arial,MS Sans Serif,Verdana,Sans-Serif; font-size:smaller; font-weight:normal;">
                          
                                <table cellpadding="0" cellspacing="0">
                                <asp:Repeater ID="CategoryRowsRepeater" OnItemDataBound="CategoryRowsRepeater_ItemDataBound" runat="server">
                                <ItemTemplate>
                                        <tr><td>
                                               <asp:Label ID="RowNumberLabel" runat="server" Text='<% #Eval("RowNumberDisplay")%>'></asp:Label>
                                               </td>
                                               <asp:Repeater ID="RowItemsRepeater" runat="server" OnItemDataBound="RowItemsRepeater_ItemDataBound" OnDataBinding="RowItemsRepeater_DataBinding">
                                               <ItemTemplate>
                                                 <td align="center"> <table cellpadding="0" cellspacing="0"><tr><td align="center"><asp:Label ID="ItemLabel" runat="server" Text="" Font-Size="X-Small"></asp:Label></td>
                                                                                                 <td align="center"><asp:TextBox ID="ItemTextBox" runat="server" Text='<%#Eval("ItemValue")%>' ToolTip='<%#Eval("BudgetCategoryHeaderId")%>'> </asp:TextBox></td></tr></table>
                                                         </td>
                                               </ItemTemplate>
                                              </asp:Repeater>
                                        </tr>
                                </ItemTemplate>
                              </asp:Repeater>
                              </table>
                              </div></td></tr>
                      </table>
   </ItemTemplate>
   </asp:DataList>
   
    </div>
   <table width="825px"><tr><td width="400px" colspan="2"></td><td align="right" style="width:300px;">Spending Plan Total:</td><td style="width:100px; text-align:right;">$<asp:TextBox ID="SpendingPlanTotalTextBox" runat="server" BorderStyle="None" Columns="6" Style="text-align:right;" BackColor="Transparent"></asp:TextBox></td></tr>
                        <tr><td colspan="2"></td><td align="right">Budget Amount:</td><td style="text-align:right;">$<asp:TextBox ID="BudgetAmountTextBox" runat="server" BorderStyle="None" Columns="6" Style="text-align:right;" BackColor="Transparent"></asp:TextBox></td></tr>
                        <tr><td align="center"><asp:Button ID="SaveButton" runat="server" Text="Save" />
                        </td><td><asp:Button ID="SubmitButton" runat="server" Text="Save and Submit" /></td>
                        <td><asp:Button ID="CancelButton" runat="server" Text="Close" /></td></tr>                        
   </table>
    </Content>
    </cc1:AccordionPane>
  </Panes>
</cc1:Accordion>
 <uc1:PopupMessage ID="PopupMessage1" runat="server" />

</div>
   
</asp:Content>

